/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mortbay.jetty.pico.pages;

import java.util.List;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.mortbay.jetty.pico.dao.category.CategoryDAO;
import org.mortbay.jetty.pico.entities.Category;


/**
 *
 * @author godfather
 */
public class CategoryAction{
    
    /*
     * Execute from action
     * 
     */
    
    @Inject 
    private CategoryDAO categoryDAO;
    
    private Category category;
    
    
    
    public List<Category> getList(){
        return categoryDAO.getList();

    }
    public boolean isEmptyList(){
        return categoryDAO.getList().isEmpty();
    }
    public void onActionFromDelete(String idCate){
        System.out.println("id: " + idCate);
        category = (Category) categoryDAO.find(idCate);
        if(category != null){
            categoryDAO.remove(category);
            //categoryDAO.removeByID(idCate);
        }
    }
    public String getName(){
        return "hello chung";
    }

    public CategoryDAO getCategoryDAO() {
        return categoryDAO;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }
    
}
